package cn.edu.scau.cmi.yangzemin.comprehension.util;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class ScauCmiHibernateSessionFactoryUtil {      
	//单例模式 ， 简单的 HibernateSessioFactory工厂类
	private static SessionFactory sessionFactory;
	private static SessionFactory getSessionFactory() {
		if(sessionFactory==null) { 
			sessionFactory = new Configuration().configure().buildSessionFactory();  
		}
		return sessionFactory;
	}
	public static Session getSession() {
		Session session = getSessionFactory().openSession();
		return session;
	}
}
        